package queries;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;

import entitys.MarketingPattern;

public class GetMarketingPatternQuery {


		public static ArrayList<MarketingPattern> exe(Connection conn) {
			ArrayList<MarketingPattern> arr = new ArrayList<MarketingPattern>();
			MarketingPattern elm;
			ResultSet res = null; 
			Statement stmt;
			
				
				try {
					stmt = conn.createStatement();
					res = stmt.executeQuery("SELECT * from ccrm.marketingpattern; ");
					while(res.next())
					{
						elm =new MarketingPattern(res.getInt(2),res.getInt(3),res.getInt(4),res.getString(5).toString(),res.getInt(6),res.getInt(7),res.getInt(8),res.getString(9).toString());
						elm.setPatternID(res.getInt(1));
						arr.add(elm);
					
					}
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

			return arr;
		}
}
